<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <div>
      <el-button type="primary" @click="logout">退出登录</el-button>
      <el-button type="primary" @click="getUser">获取部门角色</el-button>
      <el-button type="primary" @click="getWork()">获取职务</el-button>
    </div>
  </div>
</template>

<script>
  import { logout } from '@/api/user'
import { mapGetters } from 'vuex'
import {getUserList,getWork} from '@/api/user'
export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  mounted(){
    let _self=this
  },
  methods:{
    logout(){
      let res=logout()
      this.$router.push('/login')
    },
    async getUser(){
      let a={
        pageNo:1,
        pageSize:10
      }
      let res=await getUserList()
      console.log(res);
    },
    async getWork(){
      let res=await getWork()
      console.log(res);
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
